from flask_appbuilder import Model
from sqlalchemy import Column, Integer, String, Text

from myapp.app import app
from myapp.models.helpers import AuditMixinNullable

metadata = Model.metadata
conf = app.config


# 体验模型表
class ExModel(Model, AuditMixinNullable):
    __tablename__ = 'ex_model'
    id = Column(Integer, primary_key=True)
    name = Column(String(200), nullable=True)  #
    describe = Column(String(2000), nullable=True)  #

    model_id = Column(Integer, nullable=True, comment='关联的模型ID')
    can_trial = Column(Integer, nullable=True, default=2, comment='可体验')
    can_train = Column(Integer, nullable=True, default=2, comment='可训练')
    scene = Column(Integer, nullable=True, default=0, comment='应用场景')
    score = Column(Integer, nullable=True, comment='模型效果评分')

    readme = Column(Text(65536), nullable=True, comment='readme的路径')
    service_id = Column(Integer, nullable=True, comment='关联的服务ID')

    def __repr__(self):
        return self.name
